home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 27 Nov 1997
- // Author: ajp
- //
- // Description:
- // This procedure controls the behaviour of
- // the navigator buttons that appear at the
- // top of the attribute editor
- //
- // Input Arguments:
- // $type = whether we're looking for forward or
- // backward connections
- // $menu = the popup menu control name
- // ("" if the button is hit with the LMB)
- // $node = the name of the node
- //
- // Return Value:
- // None
- //
-
-
- global proc AEpropagateMenuCB(string $type, string $menu, string $node)
- {
-
- if ( $menu != "" ) {
- setParent -m $menu;
- popupMenu -e -deleteAllItems $menu;
- }
-
- // get a list of all the plugs in the desired direction
- //
- string $allPlugs[];
- string $plugs[];
- if ( $type == "-backward" ) {
- // note: since we need to do an extra filtering step for
- // backward connections, we use a temporary string array ($allPlugs)
- //
- $allPlugs = `listConnections -s false -d true -c true -p true $node`;
- } else if ( $type == "-forward" ) {
- $plugs = `listConnections -s true -d false -c true -p true $node`;
- }
-
- // loop through the plugs and filter out those that are connected
- // to invalid attributes (only for backward connections)
- //
- int $i;
- if ( size($plugs) == 0 && size($allPlugs) > 0 ) {
-
- // get a list of attributes that we'll check for connections;
- // these attributes must be:
- // visible
- // connectable
- // readOnly
- //
- string $attrs[] = `listAttr -visible -connectable -readOnly $node`;
-
- for ( $i = 0; $i < size($allPlugs); $i += 2 ) {
-
- // tokenize the indexed $allPlugs such that:
- // currentNodeBuffer[0] is the nodeName
- // currentNodeBuffer[1] is the attributeName
- // currentNodeBuffer[2] would be the multi index if defined
- //
- string $currentNodeBuffer[];
- tokenize($allPlugs[$i], ".[]", $currentNodeBuffer);
-
- // search for the attribute name in the attribute list;
- // if we find it, add it to our list of valid plugs: $plugs
- //
- for ( $j = 0; $j < size($attrs); $j++ ) {
- if ( $currentNodeBuffer[1] == $attrs[$j] ) {
- // got a valid one
- $plugs[size($plugs)] = $allPlugs[$i];
- $plugs[size($plugs)] = $allPlugs[$i+1];
- break; // from $j loop
- }
- }
-
- // if we don't want a whole menu (i.e. just
- // do a showEditor on the first item in the
- // list) we can break from this loop if we've
- // got at least one plug
- //
- if ( $menu == "" && size($plugs) > 0 ) {
- break; // from $i loop
- }
- }
- }
-
- // now we have a list of valid plugs;
- // depending on what we want to do with this list,
- // we can now either build a pop-up menu, or
- // simply show the first item in the list
- // in the attribute editor
- //
- string $currentNodeBuffer[], $connectedNodeBuffer[];
- if ( $menu == "" ) {
- // show the attribute editor for the first connection
- //
- if ( size($plugs) > 0 ) {
- tokenize($plugs[1], ".", $connectedNodeBuffer);
- showEditorExact $connectedNodeBuffer[0];
- }
- } else {
- // build the menuItems for the popup
- //
- for ( $i = 0; $i < size($plugs); $i += 2 ) {
- tokenize($plugs[$i], ".", $currentNodeBuffer);
- tokenize($plugs[$i+1], ".", $connectedNodeBuffer);
- string $command = ("showEditorExact "+$connectedNodeBuffer[0]);
- string $label = "";
- switch ( $type ) {
- case "-backward":
- $label = ($currentNodeBuffer[1]+" -> "+$plugs[$i+1]);
- break;
- case "-forward":
- $label = ($plugs[$i+1]+" -> "+$currentNodeBuffer[1]);
- break;
- default:
- break;
- }
- menuItem -l $label -c $command;
- }
- }
- }
-